<html>
<head><meta charset="utf-8"><title>0.44-0.50 upgrade question · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/0.2E44-0.2E50.20upgrade.20question.html">0.44-0.50 upgrade question</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="221988391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/0.44-0.50%20upgrade%20question/near/221988391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/0.2E44-0.2E50.20upgrade.20question.html#221988391">(Jan 07 2021 at 19:25)</a>:</h4>
<p>Hi folks! I'm using <code>cargo</code> as a library (specifically in the context of something sort of like <span class="user-mention" data-user-id="116015">@Alex Crichton</span>'s <a href="https://crates.io/crates/cargo-local-registry"><code>cargo-local-registry</code></a>), and am trying to upgrade from <code>cargo 0.44</code> to <code>cargo 0.50</code>. However, following that upgrade, it seems like source replacement through <code>Config::set_values</code> no longer works? Specifically, I have the following values set in the <code>Config</code> (as reported by <code>Config::values</code>:</p>
<div class="codehilite"><pre><span></span><code>{&quot;source&quot;: {&quot;local-registry&quot;: {&quot;local-registry&quot;: /a/local/path (from --config cli option)}, &quot;crates-io&quot;: {&quot;replace-with&quot;: local-registry (from --config cli option)}}}
</code></pre></div>
<p>And I have an index file + <code>.crate</code> file for a crate <code>foobar</code> at <code>/a/local/path/index/fo/ob/foobar</code> and <code>/a/local/path/foobar-0.1.3.crate</code> respectively. Yet when I run <code>core::resolver::resolve</code> with said config, I now get an error saying</p>
<div class="codehilite"><pre><span></span><code>no matching package named `foobar` found
location searched: registry `https://github.com/rust-lang/crates.io-index`
</code></pre></div>
<p>With <code>0.44</code> this worked just fine. It seems strange that the error message does not name the replacement registry. Did the handling of replaced registries change somehow between 0.44 and 0.50?</p>



<a name="221989193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/0.44-0.50%20upgrade%20question/near/221989193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/0.2E44-0.2E50.20upgrade.20question.html#221989193">(Jan 07 2021 at 19:31)</a>:</h4>
<p>this is probably an unrelated change which introduced or an outright bug in Cargo, but I don't think any of us remember versions well enough to pin it down. Bisection may be able to help though?</p>



<a name="221989440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/0.44-0.50%20upgrade%20question/near/221989440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/0.2E44-0.2E50.20upgrade.20question.html#221989440">(Jan 07 2021 at 19:33)</a>:</h4>
<p>Okay, I'll start doing some digging and see if I can track it down!</p>



<a name="221990360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/0.44-0.50%20upgrade%20question/near/221990360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/0.2E44-0.2E50.20upgrade.20question.html#221990360">(Jan 07 2021 at 19:39)</a>:</h4>
<p>Can confirm that this worked correctly in 0.49, so it's a regression since then. Will start bisecting.</p>



<a name="221994807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/0.44-0.50%20upgrade%20question/near/221994807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/0.2E44-0.2E50.20upgrade.20question.html#221994807">(Jan 07 2021 at 20:16)</a>:</h4>
<p>oof, the bad commit is <code>bcfdf9fbad78cf0e9ec52e84ce68f7b2a5aa19da</code>, which is the new namespaced features implementation <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> <span class="user-mention" data-user-id="120518">@Eric Huss</span></p>



<a name="221996993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/0.44-0.50%20upgrade%20question/near/221996993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/0.2E44-0.2E50.20upgrade.20question.html#221996993">(Jan 07 2021 at 20:33)</a>:</h4>
<p>I'll try to see if I can construct a small example error case when I get back from lunch. It _should_ just be a matter of calling <code>resolve</code> with a <code>Config</code> where you've used <code>replace-with</code> on <code>crates.io</code>, and where the replacement <code>local-registry</code> has a package that isn't on <a href="http://crates.io">crates.io</a> but is depended on.</p>



<a name="222011621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/0.44-0.50%20upgrade%20question/near/222011621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/0.2E44-0.2E50.20upgrade.20question.html#222011621">(Jan 07 2021 at 22:35)</a>:</h4>
<p>Ah, I see what's going on. The issue isn't actually on the consumer side of the index. The index entry I generate in the first place is now incorrect, because <code>summary().features()</code> now includes "dep" features as well, which are invalid in index entries. Specifically, if you have</p>
<div class="codehilite"><pre><span></span><code>[dependencies]
chrono = { version = &quot;*&quot;, optional = true }
</code></pre></div>
<p>Previously <code>.summary().features()</code> would be empty, whereas after the commit above it will include <code>chrono =&gt; dep:chrono</code>. Doing some digging, it appears that this was also an issue internally (e.g., for publishing), but was fixed by <a href="https://github.com/rust-lang/cargo/pull/8853">https://github.com/rust-lang/cargo/pull/8853</a>. So I suppose I'll need to find a way to fix that in my own registry index generation code.</p>



<a name="222012122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/0.44-0.50%20upgrade%20question/near/222012122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/0.2E44-0.2E50.20upgrade.20question.html#222012122">(Jan 07 2021 at 22:40)</a>:</h4>
<p>Solution appears to be to use <code>member.manifest().original().features()</code> for each member in <code>workspace.members()</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>